.TH apex-env 8 27-January-2007 "Debian GNU/Linux"
.SH NAME
apex-env \- user-mode access to APEX flash environment
.SH SYNOPSIS
.B apex-env
COMMAND
[
.B ARGS ...
]

.SH DESCRIPTION

\fBapex-env\fR is a utility for viewing and modifying the environment
used by the APEX Boot Loader to define how the system will boot.  APEX
has a predefined set of environment variables, determined by the
build-time configuration, that control operation of the boot loader.  

Embedded in the APEX image is a linking structure that \fBapex-env\fR
uses to identify the boot loader image and to locate information about
the environment variables as well as the flash region that holds the
user-modified values.  If APEX is built without enabling this
user-modifiable flash region, \fBapex-env\fR will only allow the user
to browse the variables and the default values.

\fBapex-env\fR depends on the \fI/dev/mtd\fR driver to locate the
APEX.  It first looks for a partition named 'Loader', but it will also
check the first partition in case APEX is used as the primary boot
loader.

The user may need root privileges to run \fBapex-env\fR, even when
only reading the environment.

.SH COMMANDS

.TP
describe [\fBKEY\fR]
Displays a description of \fBKEY\fR or descriptions of every environment
variable is \fBKEY\fR is omitted.

.TP
dump
Displays the contents of the flash environment region in a
hexadecimal/ASCII format useful for troubleshooting.

.TP
eraseenv
Clears the environment region by setting all of the bytes to 0xff.
Use this command with care.  Assuming that APEX was properly built for
your system, it still relies on the caching feature of the MTD block
driver to modify only a portion of a flash eraseblock.  Be mindful
that interrupting this command after the block is erased and before
the important data has been restored could render the system
unbootable.

.TP
printenv [\fBKEY\fR]
Displays the value of \fBKEY\fR or the values of every environment variable
if \fBKEY\fR is omitted.  The separator between the key and the value is =*
for default values or just = when the default value has been
overridden by a value saved in the flash environment.

.TP
setenv \fBKEY VALUE\fR
Overrides the default value of \fBKEY\fR with \fBVALUE\fR.  Use
quoting to prevent the shell from splitting \fBVALUE\fR into separate
words and from interpolation.  

.TP
unsetenv \fBKEY\fR
Restores the default value of \fBKEY\fR by marking any value stored in flash
as deleted.

.SH EXAMPLES

.TP
apex-env printenv
Show all of the environment variables and the current values for each.

.TP
apex-env setenv startup 'copy $kernelsrc $bootaddr ; boot'
Change the startup variable to copy the kernel and immediately boot.

.TP
apex-env dump | head
Examine the first few bytes of the environment data.

.SH AUTHOR
Marc Singer <elf@debian.org>

